#include "toyLexer.h"
#include "toyParser.h"
#include "parser/MLIRToyVisitor.h"

int main(){
    std::string inputFileName = "/root/mlir_test/lib/parser/test.toy";
    std::fstream in(inputFileName);
    antlr4::ANTLRInputStream input(in);
    toyLexer lexer(&input);
    antlr4::CommonTokenStream tokens(&lexer);
    toyParser parser(&tokens);
    auto root = parser.module();

    mlir::MLIRContext context;
    context.getOrLoadDialect<mlir::toy::ToyDialect>();
    
    MLIRToyVisitor visitor(inputFileName, context);
    visitor.visit(root);
    
    mlir::ModuleOp mlirModule = visitor.getModule();
    mlirModule->dump();
    return 0;
}